//
//  BaoXian.m
//  CarStor
//
//  Created by 千锋 on 16/1/18.
//  Copyright (c) 2016年 1000phone. All rights reserved.
//

#import "BaoXian.h"
#import "DetailModel.h"

@implementation BaoXian

+ (instancetype)modelWithDict:(NSDictionary *)dict;
{
    BaoXian *model = [[self alloc]init];
    [model setValuesForKeysWithDictionary:dict];
    return model;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"detail_list"]) {
        NSArray *basic = value[@"basic"];
        NSArray *must = value[@"must"];
        NSMutableArray *basics = @[].mutableCopy;
        for (NSDictionary *dic in basic) {
            DetailModel *model = [DetailModel modelWithDict:dic];
            [basics addObject:model];
        }
        
        NSMutableArray *musts = @[].mutableCopy;
        for (NSDictionary *dic in must) {
            DetailModel *model = [DetailModel modelWithDict:dic];
            [musts addObject:model];
        }
        self.details = @[basics,musts];
    }
}

@end
